package com.lefevre.cms.web.action.theme.impl;

import com.lefevre.cms.bean.links.Links;
import com.lefevre.cms.bean.theme.Forum;
import com.lefevre.cms.service.links.LinksService;
import com.lefevre.cms.web.action.fileSystem.FileManage;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 友情链接 -- 模板方法实现
 */
@Component
public class Links_TemplateManage {

    @Resource
    LinksService linksService;
    @Resource
    FileManage fileManage;

    /**
     * 友情链接列表 -- 集合
     *
     * @param forum
     */
    public List<Links> links_collection(Forum forum, Map<String, Object> parameter, Map<String, Object> runtimeParameter) {
        List<Links> linksList = linksService.findAllLinks_cache();
        if (linksList != null && linksList.size() > 0) {
            for (Links links : linksList) {
                links.setImage(fileManage.fileServerAddress() + links.getImage());
            }
        }
        return linksList;
    }
}
